package com.freshdirect.src.model;

import java.util.ArrayList;
import java.util.List;

public class ShoppingCart
{
   List<Product> products; 
   double totalPrice;
   int change;

    public ShoppingCart() {
        this.products = new ArrayList<Product>();
        this.change = 0;
    }
   

    public List<Product> getProducts() {
        return products;
    }

    public void setProducts(List<Product> products) {
        this.products = products;
    }
    
    
    public void removeProduct(int id){
        for(int i=0; i<products.size(); i++){
            if(products.get(i).getId()==id){
                products.remove(i);
            }
        }
    }
    
    public double getTotalPrice(){
        return totalPrice;
    }
    
    public void increaseTotalPrice(double value){
        this.totalPrice += value;
    }

    public void decreaseTotalPrice(double value) {
        this.totalPrice -= value;
    }
   
    public void setChange(int i){
        this.change = i;
    }
    
    public int getChange(){
        return change;
    }

    public void setTotalPrice(double i) {
        this.totalPrice = i;
    }
}